using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using Reimers.Map;
using Reimers.WebControls;

public partial class examples_csharp_sidebar : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        GMap.GoogleKey = ConfigurationManager.AppSettings["MapKey"]; //ConfigurationManager.AppSettings["MapKey"];
        GMap.MapControls.Add(new Reimers.Map.Controls.GoogleLargeMapControl("lmc"));
        GMap.Options.MapTypes.RemoveAt(2);
        GMap.Options.MapTypes.RemoveAt(1);

        GoogleMarker gm1 = new GoogleMarker("Copenhagen", 55.7, 12.6, new GoogleMarkerOptions(false));
        GoogleMarker gm2 = new GoogleMarker("London", 51.5, 0, new GoogleMarkerOptions(false));
        GoogleMarker gm3 = new GoogleMarker("Berlin", 52.5, 13.4, new GoogleMarkerOptions(false));
        GoogleMarker gm4 = new GoogleMarker("Paris", 48.8, 2.5, new GoogleMarkerOptions(false));
        GoogleMarker gm5 = new GoogleMarker("Brussels", 50.8, 4.4, new GoogleMarkerOptions(false));
        GoogleMarker gm6 = new GoogleMarker("Rome", 41.85, 12.5, new GoogleMarkerOptions(false));
        GoogleMarker gm7 = new GoogleMarker("Madrid", 40.4, -3.7, new GoogleMarkerOptions(false));
        GoogleMarker gm8 = new GoogleMarker("Vienna", 48.2, 16.35, new GoogleMarkerOptions(false));

        GMap.Overlays.Add(gm1);
        GMap.Overlays.Add(gm2);
        GMap.Overlays.Add(gm3);
        GMap.Overlays.Add(gm4);
        GMap.Overlays.Add(gm5);
        GMap.Overlays.Add(gm6);
        GMap.Overlays.Add(gm7);
        GMap.Overlays.Add(gm8);

        Sidebar.HeaderText = "Capitals";
        Sidebar.ShowHeader = true;
        Sidebar.HeaderStyle.Font.Bold = true;
        Sidebar.HeaderStyle.BackColor = System.Drawing.Color.White;
        Sidebar.ItemStyle.BackColor = System.Drawing.Color.White;
        Sidebar.AlternatingItemStyle.BackColor = System.Drawing.Color.Silver;
        Sidebar.MouseOut += new SidebarHandler(Sidebar_MouseOut);
        Sidebar.Click += new SidebarHandler(Sidebar_Click);
        Sidebar.Map = GMap.ID;
    }

    string Sidebar_Click(GoogleOverlay Item)
    {
        return GMap.OpenInfoWindowHTML(Item.Bounds.Center, string.Format("You clicked {0}.", Item.ID));
    }

    string Sidebar_MouseOut(GoogleOverlay Item)
    {
        return GMap.CloseInfoWindow();
    }
}
